import { Ollama } from "ollama";

// browser
// import ollama from "ollama/browser";

const ollama = new Ollama({ host: "http://10.11.27.60:11434" });

const message = { role: "user", content: "李白的代表作" };
const response = await ollama.chat({
  model: "llama3.1",
  messages: [message],
  stream: true,
});
for await (const part of response) {
  process.stdout.write(part.message.content);
}

// async (stream) => {
//   for await (const chunk of stream) {
//     process.stdout.write(chunk.response);
//   }
// };
// console.log(response.response);
// console.log(response.message.content);

// console.log(response);
